The value attribute tells the browser what string to display. For each item in its list, the browser evaluates the item's value.
public NSArray talentSelection() { EOEnterpriseObject aTalent; EOEnterpriseObject aMovieRole =
(EOEnterpriseObject)movieRoleDisplayGroup.selectedObject(); if (aMovieRole == null){ return null; } aTalent = (EOEnterpriseObject)aMovieRole.valueForKey("toTalent"); if (aTalent == null){ return null; } else { return new NSArray(aTalent); } }
Because the browser expects an array for its selections attribute, this method packages the selected MovieRole's talent object in an array. If the selected MovieRole object is null, talentSelection simply returns null to indicate that the browser shouldn't set a selection.
public void setTalentSelection(NSArray talentArray){ if (talentArray.count() > 0){ EOEnterpriseObject aMovieRole =
(EOEnterpriseObject)movieRoleDisplayGroup.selectedObject(); EOEnterpriseObject selectedTalent =
(EOEnterpriseObject)talentArray.objectAtIndex(0); aMovieRole.addObjectToBothSidesOfRelationshipWithKey( selectedTalent, "toTalent"); } }
Again because the browser uses an array for its selections attribute, the setTalentSelection method must take an array as its argument. If talentArray's count is nonzero, then this method sets the selected MovieRole's talent to the first object in the array. Note that by default, a user can't select more than one actor in a browser.
Table of Contents
Next Section